<tagLib name="myhtml" />
<include file="../Public/header" />
<!-- 主体内容  -->
<SCRIPT LANGUAGE="JavaScript">
 <!--


	function upoutkey(){
		ThinkAjax.sendForm('form','__URL__/outkeysave/');
		window.opener.location.reload();
		alert('操作已成功,本页面将会刷新!');
		window.close();
	}


	function gettable(){
		var key=$('key').value;
		if(key==''){
			alert('请输入关键词!');
			return false;
		}else{
			ThinkAjax.get('__URL__/ajaxTable/',"key="+key,'showtables');
		}
	}

	function showdetail(id,table){
		if(id==''){
			alert('请输入关键词!');
			return false;
		}else{
			$('outkey').value=table;
			ThinkAjax.get('__URL__/ajaxFields/',"id="+id,'showfields');
		}
	}


 //-->
 </SCRIPT>

<fieldset >
	<legend>设定本字段的外键信息</legend>

<table>
	<tr>
		<th>
		关键词:
		</th>
		<td>
		<input name="out" type="text" id="key" size="40" value="{$list['outkey']}" />
		<input type="button"  value="获取表相关信息" class="button1"  onclick="gettable();"/>
		</td>
	</tr>
</table>
</fieldset>

<fieldset >
	<legend>候选表</legend>
	<div id='showtables'></div>
</fieldset>

<fieldset >
	<legend>候选字段详细信息</legend>
	<div id='showfields'></div>
</fieldset>
<script type="text/javascript">
function updatecheckbox(){
	var s = document.getElementsByName("title_tmpval");
	var checkboxvar = document.getElementById("outkeyf");
	var s2 = "";
	for( var i = 0; i < s.length; i++ )
	{
		if ( s[i].checked ){
		s2 += s[i].value+",";
		}
	}
	s2 = s2.substr(0,s2.length-1);
	checkboxvar.value=s2;
	//alert(treuval.value);
}

function updateradio(d){
	var checkboxvar = document.getElementById("outkeyid");
	checkboxvar.value=d;
	//alert(treuval.value);
}

function defvalue(id){
	if(id==1){
		$('outkey').value='Array';
		$('outkeyid').value='1,0';
		$('outkeyf').value='是,否';
	}
	if(id==0){
		$('outkey').value='Array';
		$('outkeyid').value='';
		$('outkeyf').value='';
	}
}

</script>
<form id='form'>
<fieldset>
<legend>外键选择的结果</legend>
外键:
		<select name="outkeyis" >
		 <option value="1" <eq name="list['outkeyis']" value="1">selected</eq>  >是 </option>
		 <option value="0" <eq name="list['outkeyis']" value="0">selected</eq>  >否</option>
		</select>
外键表:<input id='outkey' name="outkey" value="{$list['outkey']}">


<span  onclick="upoutkey();" class="button1" >确定保存选定的外键数据</span>
<span  onclick="defvalue(0);" class="btn_small" title="常用设置:固定数据" >固定</span>
<span  onclick="defvalue(1);" class="btn_small" title="常用设置:是否" >是否</span>
<br>
<input type="hidden" name="id" value="{$list['id']}">
主键:<input id='outkeyid' name="outkeyid" value="{$list['outkeyid']}" style="width:80%">
<br>
外键:<input id="outkeyf" name="outkeyf" value="{$list['outkeyf']}" style="width:80%">

</fieldset>
</form>
<include file="../Public/footer" />
